package com.larkin.utils.controller;

import com.larkin.utils.utils.ZipUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;

/**
 * Created by liujin on 2019/5/26.
 *
 * @description TODO
 */
@RestController
@CrossOrigin("*")
@RequestMapping(value = "/utils")
public class UtilsController {
    private Logger logger = LoggerFactory.getLogger(UtilsController.class);
    @ResponseBody
    @RequestMapping(value = "/zip", method = RequestMethod.POST)
    public String zip(@RequestBody String body) {

        return ZipUtils.gzip(body);
    }

    @ResponseBody
    @RequestMapping(value = "/unzip", method = RequestMethod.GET)
    public String handle(@RequestParam String body) {
        return ZipUtils.gunzip(body);
    }
}
